// AntonyDlg.h : header file
//

#pragma once
#include "afxcmn.h"
#include "afxwin.h"
#include <vector>

#include "Utils.h"
#include "Env.h"
#include "CityMap.h"

#define MAPFILE "mapfile.txt"
#define TIMER_ID    WM_USER + 101
#define TIMER_RATE  75           // Update environment every 50 seconds
#define SPEED_MIN   30
#define SPEED_MAX   130

class CAntonyDlg : public CDialog
{
public:
	CAntonyDlg(CWnd* pParent = NULL);
	enum { IDD = IDD_ANTONY_DIALOG };

protected:

    // Dialog members
	HICON m_hIcon;
	CTabCtrl m_dlgTabCtrl;
	CListCtrl m_dlgLogList;
	CListCtrl m_dlgAgentList;
	CListCtrl m_dlgEnvList;
	CButton m_dlgAddTaxiBtn;
    CButton m_dlgRunSimBtn;
    CButton m_dlgPauseSimBtn;
    CButton m_dlgResetSimBtn;
    CButton m_dlgShowAllNodes;
    CButton m_dlgShowSpawns;
    CButton m_dlgShowConn;
    CButton m_dlgShowFares;
    CCityMap m_dlgMapImage;
    CStatic m_dlgMapGrp;
    CEdit m_dlgCarCount;
	
    // The one and only environment
    CEnv* m_env;
    CSysTime m_nextUpdate; 
    int m_maxCars;

    // Utility functions (not generated)
    void Log(const CString& msg);
	void InitTabs();
    void InitLists();
    void AutoSizeList(CListCtrl& list);
    void UpdateInfo();
    void UpdateAgents();

	// Generated message map functions
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
    afx_msg void OnTabSelChange(NMHDR *pNMHDR, LRESULT *pResult);
    afx_msg void OnClicked_ShowAllNodes();
    afx_msg void OnClicked_ShowConns();
    afx_msg void OnDestroy();
    afx_msg void OnTimer(UINT_PTR nIDEvent);
    afx_msg void OnClicked_Play();
    afx_msg void OnClicked_Pause();
    afx_msg void OnClick_AddAgent();
    afx_msg void OnClicked_Reset();
    afx_msg void OnChange_CarCount();
    afx_msg void OnClicked_ShowFares();

	DECLARE_MESSAGE_MAP()

public:
    CButton m_dlgShowCars;
    afx_msg void OnClicked_ShowCars();
    CSliderCtrl m_dlgSpeedSlide;
    CEdit m_dlgSpeedEdit;
    afx_msg void OnReleased_Slider(NMHDR *pNMHDR, LRESULT *pResult);
};
